

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=&#34;auto&#34;>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/favicon.png">
  <link rel="icon" type="image/png" href="/img/favicon.png">
  <meta name="viewport"
        content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="description" content="">
  <meta name="author" content="">
  <meta name="keywords" content="">
  <title>linux-常用命令 - Hexo</title>

  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css" />


  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/github-markdown-css@4.0.0/github-markdown.min.css" />
  <link  rel="stylesheet" href="/lib/hint/hint.min.css" />

  
    
    
      
      <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/highlight.js@10.4.0/styles/github-gist.min.css" />
    
  

  
    <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
  



<!-- 主题依赖的图标库，不要自行修改 -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_ba1fz6golrf.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_kmeydafke9r.css">


<link  rel="stylesheet" href="/css/main.css" />

<!-- 自定义样式保持在最底部 -->


  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    var CONFIG = {"hostname":"example.com","root":"/","version":"1.8.6","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false},"toc":{"enable":true,"headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"right","visible":"hover","icon":""},"copy_btn":true,"image_zoom":{"enable":true},"lazyload":{"enable":true,"onlypost":false},"web_analytics":{"enable":false,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null}}};
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
<meta name="generator" content="Hexo 5.3.0"></head>


<body>
  <header style="height: 70vh;">
    <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand"
       href="/">&nbsp;<strong>yun&bo</strong>&nbsp;</a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" data-toggle="modal" data-target="#modalSearch">&nbsp;<i
                class="iconfont icon-search"></i>&nbsp;</a>
          </li>
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" href="javascript:">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

    <div class="banner intro-2" id="background" parallax=true
         style="background: url('/img/index01.jpg') no-repeat center center;
           background-size: cover;">
      <div class="full-bg-img">
        <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
          <div class="page-header text-center fade-in-up">
            <span class="h2" id="subtitle" title="linux-常用命令">
              
            </span>

            
              <div class="mt-3">
  
  
    <span class="post-meta">
      <i class="iconfont icon-date-fill" aria-hidden="true"></i>
      <time datetime="2020-12-22 08:02" pubdate>
        2020年12月22日 早上
      </time>
    </span>
  
</div>

<div class="mt-1">
  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-chart"></i>
      1.3k 字
    </span>
  

  
    
    <span class="post-meta mr-2">
      <i class="iconfont icon-clock-fill"></i>
      
      
      15
       分钟
    </span>
  

  
  
</div>

            
          </div>

          
        </div>
      </div>
    </div>
  </header>

  <main>
    
      

<div class="container-fluid">
  <div class="row">
    <div class="d-none d-lg-block col-lg-2"></div>
    <div class="col-lg-8 nopadding-md">
      <div class="container nopadding-md" id="board-ctn">
        <div class="py-5" id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">linux-常用命令</h1>
            
            <div class="markdown-body">
              <blockquote class="pullquote mindmap mindmap-md"><ul>
<li>linux命令
<ul>
<li>常用命令
<ul>
<li>查看内核函数
<ul>
<li>man socket</li>
</ul>
</li>
<li>查看文件读取权限
<ul>
<li>ls -l</li>
</ul>
</li>
<li>访问网页
<ul>
<li>curl
<ul>
<li>参数
<ul>
<li>-i 返回响应头和内容</li>
<li>-I 只返回响应头</li>
<li>-L 对页面进行重定向</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>基础命令
<ul>
<li>注销
<ul>
<li>logout</li>
</ul>
</li>
<li>关机或重新启动
<ul>
<li>shutdown</li>
<li>shutdown now 立刻关机</li>
<li>shutdown +5 五分钟后关机</li>
<li>shutdown 10：30 在10：30时管理</li>
<li>#shutdown -r 23:59 指定在23:59时重新启动</li>
<li>shutdown -r now 立刻关闭系统并重启</li>
</ul>
</li>
<li>文件与目录的操作
<ul>
<li>列出文件列表
<ul>
<li>ls 显示当前目录</li>
<li>ls -a  显示以“.”开头的文件</li>
<li>ls -s -S 以“-s”参数显示每个文件所有的空间，并以“-S”参数按所有空间占用大小排序</li>
</ul>
</li>
<li>切换目录
<ul>
<li>cd 切换到用户主目录</li>
<li>cd… 切换到上级目录</li>
<li>cd/ 切换到系统根目录</li>
</ul>
</li>
<li>创建目录
<ul>
<li>mkdir 创建子目录</li>
<li>rmdir 删除目录</li>
</ul>
</li>
<li>复制文件
<ul>
<li>cp data1.txt data2.txt
<ul>
<li>将data1.txt 复制成 data2.txt</li>
</ul>
</li>
<li>cp data3.txt/tmp/data
<ul>
<li>将data3复制到/tmp/data目录中</li>
</ul>
</li>
<li>cp -v zip.txt zip3.txt
<ul>
<li>以-v显示复制过程</li>
</ul>
</li>
<li>cp -v -R * backup
<ul>
<li>将所有文件包含子目录，复制到backup目录</li>
</ul>
</li>
</ul>
</li>
<li>删除文件或目录
<ul>
<li>rm myfile
<ul>
<li>删除制定的文件</li>
</ul>
</li>
<li>rm *
<ul>
<li>删除当前目录中的所有文件</li>
</ul>
</li>
<li>rm -f *.txt
<ul>
<li>强迫删除文件</li>
</ul>
</li>
<li>rm -r data
<ul>
<li>删除data目录(含data目录下的所有文件和子目录)</li>
</ul>
</li>
<li>rm -r *
<ul>
<li>删除所有文件，含当前目录和子目录下的文件</li>
</ul>
</li>
<li>rm -rf tmp
<ul>
<li>强制删除tmp 目录及该目录下的所有文件及子目录</li>
</ul>
</li>
<li>rm -v
<ul>
<li>显示删除过程，使用v参数</li>
</ul>
</li>
</ul>
</li>
<li>让画面暂停的 more 命令
<ul>
<li>ls-al more
<ul>
<li>使用ls命令查看文件列表时，若文件太多可配合more命令使用</li>
</ul>
</li>
<li>more data.txt
<ul>
<li>单独使用more 命令时，可以用来显示文件内容</li>
</ul>
</li>
</ul>
</li>
<li>链接文件的cat命令
<ul>
<li>cat text2.txt
<ul>
<li>显示文件内容</li>
</ul>
</li>
<li>cat  preface.txt&gt;&gt;outline.txt
<ul>
<li>将preface.txt附加到outline.txt文件之后</li>
</ul>
</li>
<li>cat new.txtinfo.txt&gt;readme.txt
<ul>
<li>将new.txt和info.txt合并成readme.txt文件</li>
</ul>
</li>
</ul>
</li>
<li>移动或更换文件，目录名称的mv命令
<ul>
<li>mv a.txt …
<ul>
<li>将a.txt 文件移到上层目录</li>
</ul>
</li>
<li>mv z1.txt z3.txt
<ul>
<li>将z1.txt 改名为 z3.txt</li>
</ul>
</li>
<li>mv backup …
<ul>
<li>backup 目录上移</li>
</ul>
</li>
</ul>
</li>
<li>显示当前所在目录
<ul>
<li>pwd
<ul>
<li>显示用户所在目录</li>
</ul>
</li>
</ul>
</li>
<li>查找文件
<ul>
<li>locate
<ul>
<li>搜索包含指定条件字符串的文件或目录</li>
</ul>
</li>
<li>grep text *.conf
<ul>
<li>搜索特定字符串并显示出来，搜索当前目录中名为.conf且包含“text”字符串</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</blockquote>
<ul>
<li>linux命令
<ul>
<li>常用命令
<ul>
<li>查看内核函数
<ul>
<li>man socket</li>
</ul>
</li>
<li>查看文件读取权限
<ul>
<li>ls -l</li>
</ul>
</li>
<li>访问网页
<ul>
<li>curl
<ul>
<li>参数
<ul>
<li>-i 返回响应头和内容</li>
<li>-I 只返回响应头</li>
<li>-L 对页面进行重定向</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>基础命令
<ul>
<li>注销
<ul>
<li>logout</li>
</ul>
</li>
<li>关机或重新启动
<ul>
<li>shutdown</li>
<li>shutdown now 立刻关机</li>
<li>shutdown +5 五分钟后关机</li>
<li>shutdown 10：30 在10：30时管理</li>
<li>#shutdown -r 23:59 指定在23:59时重新启动</li>
<li>shutdown -r now 立刻关闭系统并重启</li>
</ul>
</li>
<li>文件与目录的操作
<ul>
<li>列出文件列表
<ul>
<li>ls 显示当前目录</li>
<li>ls -a  显示以“.”开头的文件</li>
<li>ls -s -S 以“-s”参数显示每个文件所有的空间，并以“-S”参数按所有空间占用大小排序</li>
</ul>
</li>
<li>切换目录
<ul>
<li>cd 切换到用户主目录</li>
<li>cd… 切换到上级目录</li>
<li>cd/ 切换到系统根目录</li>
</ul>
</li>
<li>创建目录
<ul>
<li>mkdir 创建子目录</li>
<li>rmdir 删除目录</li>
</ul>
</li>
<li>复制文件
<ul>
<li>cp data1.txt data2.txt
<ul>
<li>将data1.txt 复制成 data2.txt</li>
</ul>
</li>
<li>cp data3.txt/tmp/data
<ul>
<li>将data3复制到/tmp/data目录中</li>
</ul>
</li>
<li>cp -v zip.txt zip3.txt
<ul>
<li>以-v显示复制过程</li>
</ul>
</li>
<li>cp -v -R * backup
<ul>
<li>将所有文件包含子目录，复制到backup目录</li>
</ul>
</li>
</ul>
</li>
<li>删除文件或目录
<ul>
<li>rm myfile
<ul>
<li>删除制定的文件</li>
</ul>
</li>
<li>rm *
<ul>
<li>删除当前目录中的所有文件</li>
</ul>
</li>
<li>rm -f *.txt
<ul>
<li>强迫删除文件</li>
</ul>
</li>
<li>rm -r data
<ul>
<li>删除data目录(含data目录下的所有文件和子目录)</li>
</ul>
</li>
<li>rm -r *
<ul>
<li>删除所有文件，含当前目录和子目录下的文件</li>
</ul>
</li>
<li>rm -rf tmp
<ul>
<li>强制删除tmp 目录及该目录下的所有文件及子目录</li>
</ul>
</li>
<li>rm -v
<ul>
<li>显示删除过程，使用v参数</li>
</ul>
</li>
</ul>
</li>
<li>让画面暂停的 more 命令
<ul>
<li>ls-al more
<ul>
<li>使用ls命令查看文件列表时，若文件太多可配合more命令使用</li>
</ul>
</li>
<li>more data.txt
<ul>
<li>单独使用more 命令时，可以用来显示文件内容</li>
</ul>
</li>
</ul>
</li>
<li>链接文件的cat命令
<ul>
<li>cat text2.txt
<ul>
<li>显示文件内容</li>
</ul>
</li>
<li>cat  preface.txt&gt;&gt;outline.txt
<ul>
<li>将preface.txt附加到outline.txt文件之后</li>
</ul>
</li>
<li>cat new.txtinfo.txt&gt;readme.txt
<ul>
<li>将new.txt和info.txt合并成readme.txt文件</li>
</ul>
</li>
</ul>
</li>
<li>移动或更换文件，目录名称的mv命令
<ul>
<li>mv a.txt …
<ul>
<li>将a.txt 文件移到上层目录</li>
</ul>
</li>
<li>mv z1.txt z3.txt
<ul>
<li>将z1.txt 改名为 z3.txt</li>
</ul>
</li>
<li>mv backup …
<ul>
<li>backup 目录上移</li>
</ul>
</li>
</ul>
</li>
<li>显示当前所在目录
<ul>
<li>pwd
<ul>
<li>显示用户所在目录</li>
</ul>
</li>
</ul>
</li>
<li>查找文件
<ul>
<li>locate
<ul>
<li>搜索包含指定条件字符串的文件或目录</li>
</ul>
</li>
<li>grep text *.conf
<ul>
<li>搜索特定字符串并显示出来，搜索当前目录中名为.conf且包含“text”字符串</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/kity@2.0.4/dist/kity.min.js"></script><script type="text/javascript" src="https://cdn.jsdelivr.net/npm/kityminder-core@1.4.50/dist/kityminder.core.min.js"></script><script defer="true" type="text/javascript" src="https://cdn.jsdelivr.net/npm/hexo-simple-mindmap@0.2.0/dist/mindmap.min.js"></script><link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/hexo-simple-mindmap@0.2.0/dist/mindmap.min.css">
            </div>
            <hr>
            <div>
              <div class="post-metas mb-3">
                
                
              </div>
              
                <p class="note note-warning">本博客所有文章除特别声明外，均采用 <a target="_blank" href="https://creativecommons.org/licenses/by-sa/4.0/deed.zh" rel="nofollow noopener noopener">CC BY-SA 4.0 协议</a> ，转载请注明出处！</p>
              
              
                <div class="post-prevnext row">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2021/01/13/jsp%E5%92%8Cservlet%E7%9A%84%E5%8C%BA%E5%88%AB/">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">jsp和servlet的区别?</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2020/12/21/Redis%E5%85%A5%E9%97%A8/">
                        <span class="hidden-mobile">Redis入门</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>
    
      <div class="d-none d-lg-block col-lg-2 toc-container" id="toc-ctn">
        <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>

      </div>
    
  </div>
</div>

<!-- Custom -->


    

    
      <a id="scroll-top-button" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v"
                 for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>
    

    
  </main>

  <footer class="text-center mt-5 py-3">
  <div class="footer-content">
     <a href="https://gitee.com/YunBoZhang" target="_blank" rel="nofollow noopener"><span>Gitee</span></a> <i class="iconfont icon-love"></i> <a href="https://gitee.com/YunBoZhang" target="_blank" rel="nofollow noopener"><span>Gitee</span></a> 
  </div>
  

  

  
</footer>

<!-- SCRIPTS -->

  <script  src="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":200})
    NProgress.start()
    document.addEventListener('DOMContentLoaded', function() {
      window.NProgress && window.NProgress.inc();
    })
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js" ></script>
<script  src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.min.js" ></script>
<script  src="/js/debouncer.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>

<!-- Plugins -->


  
    <script  src="/js/lazyload.js" ></script>
  



  



  <script  src="https://cdn.jsdelivr.net/npm/tocbot@4.12.0/dist/tocbot.min.js" ></script>



  <script  src="https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js" ></script>



  <script  src="https://cdn.jsdelivr.net/npm/anchor-js@4.3.0/anchor.min.js" ></script>



  <script defer src="https://cdn.jsdelivr.net/npm/clipboard@2.0.6/dist/clipboard.min.js" ></script>






  <script  src="https://cdn.jsdelivr.net/npm/typed.js@2.0.11/lib/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var title = document.getElementById('subtitle').title;
      
      typing(title)
      
    })(window, document);
  </script>



  <script  src="/js/local-search.js" ></script>
  <script>
    (function () {
      var path = "/local-search.xml";
      var inputArea = document.querySelector("#local-search-input");
      inputArea.onclick = function () {
        searchFunc(path, 'local-search-input', 'local-search-result');
        this.onclick = null
      }
    })()
  </script>















<!-- 主题的启动项 保持在最底部 -->
<script  src="/js/boot.js" ></script>



</body>
</html>
